package com.transitionseverywhere.utils;

import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.animation.TypeConverter;
import android.graphics.Path;
import android.os.Build;
import android.util.Property;
import android.view.View;
import com.transitionseverywhere.PathMotion;

/* loaded from: classes.dex */
public class AnimatorUtils {
    private static final BaseAnimatorCompat IMPL;

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static class BaseAnimatorCompat {
        public void addPauseListener(Animator animator, Animator.AnimatorPauseListener animatorPauseListener) {
        }

        public boolean hasOverlappingRendering(View view) {
            return true;
        }

        public boolean isAnimatorStarted(Animator animator) {
            return false;
        }

        public ObjectAnimator ofFloat(View view, Property<View, Float> property, float f, float f2) {
            return null;
        }

        public ObjectAnimator ofInt(View view, Property<View, Integer> property, float f, float f2) {
            return null;
        }

        public <T> Animator ofPointF(T t, PointFProperty<T> pointFProperty, float f, float f2, float f3, float f4) {
            return null;
        }

        public <T> Animator ofPointF(T t, PointFProperty<T> pointFProperty, Path path) {
            return null;
        }

        public void pause(Animator animator) {
        }

        public void resume(Animator animator) {
        }

        BaseAnimatorCompat() {
        }
    }

    /* loaded from: classes.dex */
    static class IceCreamSandwichAnimatorCompat extends BaseAnimatorCompat {
        IceCreamSandwichAnimatorCompat() {
        }

        @Override // com.transitionseverywhere.utils.AnimatorUtils.BaseAnimatorCompat
        public void pause(Animator animator) {
            animator.cancel();
        }

        @Override // com.transitionseverywhere.utils.AnimatorUtils.BaseAnimatorCompat
        public <T> Animator ofPointF(T t, PointFProperty<T> pointFProperty, float f, float f2, float f3, float f4) {
            return PointFAnimator.ofPointF(t, pointFProperty, f, f2, f3, f4);
        }

        @Override // com.transitionseverywhere.utils.AnimatorUtils.BaseAnimatorCompat
        public <T> Animator ofPointF(T t, PointFProperty<T> pointFProperty, Path path) {
            return PathAnimatorCompat.ofPointF(t, pointFProperty, path);
        }

        @Override // com.transitionseverywhere.utils.AnimatorUtils.BaseAnimatorCompat
        public boolean isAnimatorStarted(Animator animator) {
            return animator.isStarted();
        }

        @Override // com.transitionseverywhere.utils.AnimatorUtils.BaseAnimatorCompat
        public ObjectAnimator ofFloat(View view, Property<View, Float> property, float f, float f2) {
            float floatValue = property.get(view).floatValue() * f;
            float floatValue2 = property.get(view).floatValue() * f2;
            if (floatValue == floatValue2) {
                return null;
            }
            property.set(view, Float.valueOf(floatValue));
            return ObjectAnimator.ofFloat(view, property, floatValue2);
        }

        @Override // com.transitionseverywhere.utils.AnimatorUtils.BaseAnimatorCompat
        public ObjectAnimator ofInt(View view, Property<View, Integer> property, float f, float f2) {
            int intValue = (int) (property.get(view).intValue() * f);
            int intValue2 = (int) (property.get(view).intValue() * f2);
            if (intValue == intValue2) {
                return null;
            }
            property.set(view, Integer.valueOf(intValue));
            return ObjectAnimator.ofInt(view, property, intValue2);
        }
    }

    /* loaded from: classes.dex */
    static class JellyBeanCompat extends IceCreamSandwichAnimatorCompat {
        JellyBeanCompat() {
        }

        @Override // com.transitionseverywhere.utils.AnimatorUtils.BaseAnimatorCompat
        public boolean hasOverlappingRendering(View view) {
            return view.hasOverlappingRendering();
        }
    }

    /* loaded from: classes.dex */
    static class KitKatAnimatorCompat extends JellyBeanCompat {
        KitKatAnimatorCompat() {
        }

        @Override // com.transitionseverywhere.utils.AnimatorUtils.BaseAnimatorCompat
        public void addPauseListener(Animator animator, Animator.AnimatorPauseListener animatorPauseListener) {
            animator.addPauseListener(animatorPauseListener);
        }

        @Override // com.transitionseverywhere.utils.AnimatorUtils.IceCreamSandwichAnimatorCompat, com.transitionseverywhere.utils.AnimatorUtils.BaseAnimatorCompat
        public void pause(Animator animator) {
            animator.pause();
        }

        @Override // com.transitionseverywhere.utils.AnimatorUtils.BaseAnimatorCompat
        public void resume(Animator animator) {
            animator.resume();
        }
    }

    /* loaded from: classes.dex */
    static class LollipopAnimatorCompat extends KitKatAnimatorCompat {
        LollipopAnimatorCompat() {
        }

        @Override // com.transitionseverywhere.utils.AnimatorUtils.IceCreamSandwichAnimatorCompat, com.transitionseverywhere.utils.AnimatorUtils.BaseAnimatorCompat
        public <T> Animator ofPointF(T t, PointFProperty<T> pointFProperty, Path path) {
            return ObjectAnimator.ofObject(t, pointFProperty, (TypeConverter) null, path);
        }
    }

    static {
        int i = Build.VERSION.SDK_INT;
        if (i >= 21) {
            IMPL = new LollipopAnimatorCompat();
        } else if (i >= 19) {
            IMPL = new KitKatAnimatorCompat();
        } else if (i >= 16) {
            IMPL = new JellyBeanCompat();
        } else if (i >= 14) {
            IMPL = new IceCreamSandwichAnimatorCompat();
        } else {
            IMPL = new BaseAnimatorCompat();
        }
    }

    public static void addPauseListener(Animator animator, Animator.AnimatorPauseListener animatorPauseListener) {
        IMPL.addPauseListener(animator, animatorPauseListener);
    }

    public static void pause(Animator animator) {
        IMPL.pause(animator);
    }

    public static void resume(Animator animator) {
        IMPL.resume(animator);
    }

    public static <T> Animator ofPointF(T t, PointFProperty<T> pointFProperty, float f, float f2, float f3, float f4) {
        return IMPL.ofPointF(t, pointFProperty, f, f2, f3, f4);
    }

    public static <T> Animator ofPointF(T t, PointFProperty<T> pointFProperty, Path path) {
        if (path != null) {
            return IMPL.ofPointF(t, pointFProperty, path);
        }
        return null;
    }

    public static <T> Animator ofPointF(T t, PointFProperty<T> pointFProperty, PathMotion pathMotion, float f, float f2, float f3, float f4) {
        if (f == f3 && f2 == f4) {
            return null;
        }
        if (pathMotion == null || pathMotion.equals(PathMotion.STRAIGHT_PATH_MOTION)) {
            return ofPointF(t, pointFProperty, f, f2, f3, f4);
        }
        return ofPointF(t, pointFProperty, pathMotion.getPath(f, f2, f3, f4));
    }

    public static boolean isAnimatorStarted(Animator animator) {
        return IMPL.isAnimatorStarted(animator);
    }

    public static boolean hasOverlappingRendering(View view) {
        return IMPL.hasOverlappingRendering(view);
    }

    public static ObjectAnimator ofFloat(View view, Property<View, Float> property, float f, float f2) {
        return IMPL.ofFloat(view, property, f, f2);
    }

    public static ObjectAnimator ofInt(View view, Property<View, Integer> property, float f, float f2) {
        return IMPL.ofInt(view, property, f, f2);
    }
}
